<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';

if($_RQ['op']=='get'){
	//显示统计数据
	$plugins = $this->plugins();
	$cmsdatas = $plugins[1]['list'];
	$num =0;
	foreach($cmsdatas as $k=>&$item){
		$item['num'] = 1;
		$membernum=pdo_count('jy_cms_member',array('uniacid'=>$_SESSION['uniacid'],'isblack'=>0,'pluginname'=>$item['name']));
		$item['data'] = $membernum;
		if($k>3){
			unset($item);
		}
		$num +=1;
	}
	$one_num = intval(12 / $num);
	$daydatas = $plugins[1]['list'];
	foreach($daydatas as $k=>&$item){
		$item['num'] = 1;
		$membernum=pdo_count('jy_cms_member',array('uniacid'=>$_SESSION['uniacid'],'isblack'=>0,'createtime >'=>strtotime(date('ymd')),'pluginname'=>$item['name']));
		$item['data'] = $membernum;
		if($k>3){
			unset($item);
		}
	}
	$appdatas = $plugins[1]['list'];
	foreach($appdatas as &$item){
		$item['name'] = $item['title'];
		$membernum=pdo_count('jy_cms_member',array('uniacid'=>$_SESSION['uniacid'],'isblack'=>0,'pluginname'=>$item['name']));
		$item['value'] = $membernum;
	}
	$appmdatas = $plugins[1]['list'];
	foreach($appmdatas as &$item){
		$item['name'] = $item['title'];
		$membernum=pdo_count('jy_cms_message',array('uniacid'=>$_SESSION['uniacid'],'pluginname'=>$item['name']));
		$item['value'] = $membernum;
	}
	$htmls=array(
		array('type'=>'data','num'=>12,'one_num'=>$one_num,'title'=>'总门户数据','datas'=>$cmsdatas),
		array('type'=>'data','num'=>12,'one_num'=>$one_num,'title'=>'今日门户数据','datas'=>$daydatas),
		array('type'=>'echarts_pie','one_num'=>2,'width'=>'50%','ecid'=>'member','title'=>'应用数据分布图','datas'=>array(
					'time' => date("Y-m-d H:i:s", time()),
					'datas'=>$appdatas,
		)),
		array('type'=>'echarts_pie','one_num'=>2,'width'=>'50%','ecid'=>'message','title'=>'应用信息分布图','datas'=>array(
					'time' => date("Y-m-d H:i:s", time()),
					'datas'=>$appmdatas,
		)),
	);
	$iswechat=pdo_getcolumn('core_account_wechat',array('uniacid'=>$_SESSION['uniacid']),'id');
	$site=pdo_get('core_accounts',array('uniacid'=>$_SESSION['uniacid']),array('title','logo','desc','ewm','credit2','groupid'));
	if($_SESSION['os']=='windows' && (empty($setting['share_title']) || empty($setting['hdps']))){
		if(empty($site['title']) || empty($site['desc'])){
			$htmls[]=array('type'=>'intro','title'=>'新手引导','datas'=>array(
				array('element'=>'#gowelcome','intro'=>'主人您好！您还没有设置好站点信息噢！</br>只有设置好了信息，才能有好的体验！点这里开始噢！</br>点这里-》返回系统-》站点设置','position'=>'bottom-middle-aligned'),
			));
		}elseif(empty($iswechat)){
			$htmls[]=array('type'=>'intro','title'=>'新手引导','datas'=>array(
				array('element'=>'#gowelcome','intro'=>'主人您好！您还没有添加默认公众号噢！</br>添加了默认有效的公众号，才能实现扫码登录，粉丝同步，微信支付等体验！</br>点这里-》返回系统-》应用端-》公众号管理','position'=>'bottom-middle-aligned'),
			));
		}
	}
	$return=array('htmls'=>$htmls);
	exi($return);
}